/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring.Model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author kerife
 */
@Entity
@Table(name = "salon")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Salon.findAll", query = "SELECT s FROM Salon s"),
    @NamedQuery(name = "Salon.findByIdSalon", query = "SELECT s FROM Salon s WHERE s.salonPK.idSalon = :idSalon"),
    @NamedQuery(name = "Salon.findByLetra", query = "SELECT s FROM Salon s WHERE s.salonPK.letra = :letra"),
    @NamedQuery(name = "Salon.findByIdTipo", query = "SELECT s FROM Salon s WHERE s.idTipo = :idTipo")})
public class Salon implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SalonPK salonPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_tipo")
    private int idTipo;

    public Salon() {
    }

    public Salon(SalonPK salonPK) {
        this.salonPK = salonPK;
    }

    public Salon(SalonPK salonPK, int idTipo) {
        this.salonPK = salonPK;
        this.idTipo = idTipo;
    }

    public Salon(String idSalon, char letra) {
        this.salonPK = new SalonPK(idSalon, letra);
    }

    public SalonPK getSalonPK() {
        return salonPK;
    }

    public void setSalonPK(SalonPK salonPK) {
        this.salonPK = salonPK;
    }

    public int getIdTipo() {
        return idTipo;
    }

    public void setIdTipo(int idTipo) {
        this.idTipo = idTipo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salonPK != null ? salonPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Salon)) {
            return false;
        }
        Salon other = (Salon) object;
        if ((this.salonPK == null && other.salonPK != null) || (this.salonPK != null && !this.salonPK.equals(other.salonPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Salon[ salonPK=" + salonPK + " ]";
    }
    
}
